The brains of mammals contain an extraordinarily large number of neurons whose activity and interconnections determine the function of circuits that monitor our sensory environment, dictate our motor choices, form memories, and guide all behavior. However we do not understand how the activity of these circuits governs brain activity. A fundamental limitation has been the inability to monitor and control the activity of a significan fraction of brain cells at any one time - thus typical studies of the neural underpinnings of behavior monitor at most ~100 cells simultaneously, or approximately one millionth of the total. In order to gain insight how circuit computations are carried out and subsequently control behavior, we will develop two novel technologies. The first is a radical new class of electrode with 50-100 times more recording sites than is typical and with on-board electronics, allowing unprecedented quality recordings of high number of neurons. The second is a novel way to deliver light into the brain in a controlled manner in order to be able to perturb the activity of neurons with high precision.